def remove_duplicates(input_file, output_file):
    # 使用集合来去除重复的手机号
    unique_numbers = set()

    # 读取输入文件
    with open(input_file, 'r') as file:
        for line in file:
            # 去掉每行的换行符和前后的空格
            number = line.strip()
            if number:
                unique_numbers.add(number)

    # 将去重后的号码写入输出文件
    with open(output_file, 'w') as file:
        for number in sorted(unique_numbers):
            file.write(number + '\n')

    print(f"去重完成，结果已保存到：{output_file}")

if __name__ == "__main__":
    # 输入和输出文件名
    input_filename = 'out001.txt'  # 输入文件名
    output_filename = 'total_unique.txt'  # 去重后的输出文件名

    remove_duplicates(input_filename, output_filename)
